<?php
if(!defined('access')) {
echo 'You cannot access this file directly.';
exit();
} 
if (($this->Movies_Path != null) || (file_exists($this->Movies_Path))) {
    switch ($this->mode) {
        case "genreSelection": $nextmode = "genre";
            break;
        case "yearSelection": $nextmode = "year";
            break;
        case "alphaSelection": $nextmode = "alpha";
            break;
        case "genre":
        case "year":
        case "alpha":
        case "recent":
        case "notwatched":
        case "moviesearch": $nextmode = "moviesheet";
            break;
    }
    $rss = '<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<sublang>
	<mediaDisplay>
		<onEnter>
			popupHeader = "Subtitle language";
			popupOptionSize = 2;
			popupOptions = pushBackStringArray(popupOptions, "Romanian");
			popupOptions = pushBackStringArray(popupOptions, "English");
		</onEnter>
	</mediaDisplay>
</sublang>
<bookmark>Jukebox</bookmark>
<onRefresh>
setRefreshTime(-1);
redrawDisplay();
</onRefresh>
<script>
playz = readStringFromFile("/usr/local/etc/.playz");
</script>';
    if ($this->Jukebox_Size == "sheetmovie") {
        $rss .= '
<onEnter>playItemURL(-1, 1);</onEnter>
<onExit>
  playItemURL(-1, 1);
</onExit>';
    } else {
        $rss .= '
    <onEnter>
    redrawDisplay();
  </onEnter>

<onExit>
  playItemURL(-1, 1);                              /* Stop the video on exit */
</onExit>';
    }
    $rss .= '
<script>
		Jukebox_Path = "' . SRJG::JFOLDER . '";
		DefaultView = "' . $this->Jukebox_Size . '";
            Category_Title = "' . $this->category_title . '";
	    Category_Background = "' . SRJG::JFOLDER . 'images/background.jpg";
            setFocusItemIndex(' . $this->item_pos . ');
            Current_Item_index=0;
            Genre_Title = Category_Title;
	    Jukebox_Size ="' . $this->Jukebox_Size . '";
	    mode = "' . $this->mode . '";
	    nextmode = "' . $nextmode . '";
		jukebox_top = "' . LANG::jukeboxtop . '";
    Cd2 = "false";
	</script>

<mediaDisplay ';
    if ($this->Jukebox_Size == "2x6") {
        $rss .= 'name="photoFocusView" rowCount="2" columnCount="6" showHeader="no" showDefaultInfo="no" drawItemBorder="no" viewAreaXPC="0" viewAreaYPC="0" viewAreaWidthPC="100" viewAreaHeightPC="100" itemWidthPC="14.06" itemHeightPC="35.42" itemOffsetXPC="5.5" itemOffsetYPC="12.75" itemBackgroundColor="-1:-1:-1" sideTopHeightPC="0" sideBottomHeightPC="0" bottomYPC="100" idleImageXPC="67.81" idleImageYPC="89.17" idleImageWidthPC="4.69" idleImageHeightPC="4.17" backgroundColor="-1:-1:-1" ';
    } else if ($this->Jukebox_Size == "sheetwall") {
        $rss .= 'name="photoView" focusItemWidthPC="16.5" focusItemHeightPC="43" focusItemOffsetYPC="17" rowCount="1" columnCount="7" showHeader="no" showDefaultInfo="no" drawItemBorder="no" viewAreaXPC="0" viewAreaYPC="0" viewAreaWidthPC="100" viewAreaHeightPC="100" itemWidthPC="10.3" itemHeightPC="20" itemOffsetXPC="11" itemOffsetYPC="68" itemBackgroundColor="-1:-1:-1" sideTopHeightPC="0" sideBottomHeightPC="0" bottomYPC="100" idleImageXPC="67.81" idleImageYPC="89.17" idleImageWidthPC="4.69" idleImageHeightPC="4.17" backgroundColor="-1:-1:-1" ';
    } else if ($this->Jukebox_Size == "sheetmovie") {
        $rss .= 'name="photoFocusView" focusItemWidthPC="16.5" focusItemHeightPC="43" focusItemOffsetYPC="17" rowCount="1" columnCount="1" showHeader="no" showDefaultInfo="no" drawItemBorder="no" viewAreaXPC="0" viewAreaYPC="0" viewAreaWidthPC="100" viewAreaHeightPC="100" itemWidthPC="16.5" itemHeightPC="44" itemOffsetXPC="7" itemOffsetYPC="16" itemBackgroundColor="-1:-1:-1" sideTopHeightPC="0" sideBottomHeightPC="0" bottomYPC="100" idleImageXPC="67.81" idleImageYPC="89.17" idleImageWidthPC="4.69" idleImageHeightPC="4.17" backgroundColor="-1:-1:-1" ';
    } else {
        $rss .= 'name="photoView" rowCount="3" columnCount="8" showHeader="no" showDefaultInfo="no" drawItemBorder="no" viewAreaXPC="0" viewAreaYPC="0" viewAreaWidthPC="100" viewAreaHeightPC="100" itemWidthPC="10.3" itemHeightPC="23.42" itemOffsetXPC="5.5" itemOffsetYPC="12.75" itemBackgroundColor="-1:-1:-1" sideTopHeightPC="0" sideBottomHeightPC="0" bottomYPC="100" idleImageXPC="67.81" idleImageYPC="89.17" idleImageWidthPC="4.69" idleImageHeightPC="4.17" backgroundColor="-1:-1:-1" ';
    }
    $rss .= '
            >

		<idleImage> image/POPUP_LOADING_01.png </idleImage>
		<idleImage> image/POPUP_LOADING_02.png </idleImage>
		<idleImage> image/POPUP_LOADING_03.png </idleImage>
		<idleImage> image/POPUP_LOADING_04.png </idleImage>
		<idleImage> image/POPUP_LOADING_05.png </idleImage>
		<idleImage> image/POPUP_LOADING_06.png </idleImage>
		<idleImage> image/POPUP_LOADING_07.png </idleImage>
		<idleImage> image/POPUP_LOADING_08.png </idleImage>';
    if (($this->Jukebox_Size == "2x6") || ($this->Jukebox_Size == "3x8")) {
        $rss .= '
<backgroundDisplay>
            <script>
                 Jukebox_itemSize = getPageInfo("itemCount"); 
			</script>
			<image type="image/jpeg" redraw="no" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="100">
				<script>
					print(Category_Background);
				</script>
		  	</image>      
		</backgroundDisplay>   

        <text redraw="no" align="center" offsetXPC="2" offsetYPC="1" widthPC="96" heightPC="3" fontSize="12" backgroundColor="-1:-1:-1" foregroundColor="130:130:130">
			<script>
				print(jukebox_top);
			</script>
		</text>
   
		<text redraw="no" align="center" offsetXPC="2.5" offsetYPC="3" widthPC="90" heightPC="10" fontSize="20" backgroundColor="-1:-1:-1" foregroundColor="192:192:192">
			<script>
			    print(Category_Title);
			</script>
		</text>';
    } else if ($this->Jukebox_Size == "simple") {
        $rss .= '
<backgroundDisplay>
            <script>
                 Jukebox_itemSize = getPageInfo("itemCount"); 
			</script>
			<image type="image/jpeg" redraw="no" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="100">
				<script>
					print(Category_Background);
				</script>
		  	</image>      
		</backgroundDisplay>   

        <text redraw="no" align="center" offsetXPC="2" offsetYPC="1" widthPC="96" heightPC="3" fontSize="12" backgroundColor="-1:-1:-1" foregroundColor="130:130:130">
			<script>
				print(jukebox_top);
			</script>
		</text>
   
		<text redraw="no" align="center" offsetXPC="2.5" offsetYPC="3" widthPC="90" heightPC="10" fontSize="20" backgroundColor="-1:-1:-1" foregroundColor="192:192:192">
			<script>
			    print(Category_Title);
			</script>
		</text>';
    } else if ($this->Jukebox_Size == "sheetwall") {
        if (($this->mode == "genreSelection") || ($this->mode == "yearSelection") || ($this->mode == "alphaSelection")) {
            $rss .= '
<backgroundDisplay>
            <script>
                 Jukebox_itemSize = getPageInfo("itemCount"); 
			</script>
			<image type="image/jpeg" redraw="no" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="100">
				<script>
					print(Category_Background);
				</script>
		  	</image>      
		</backgroundDisplay>   

        <text redraw="no" align="center" offsetXPC="2" offsetYPC="1" widthPC="96" heightPC="3" fontSize="12" backgroundColor="-1:-1:-1" foregroundColor="130:130:130">
			<script>
				print(jukebox_top);
			</script>
		</text>
   
		<text redraw="no" align="center" offsetXPC="2.5" offsetYPC="3" widthPC="90" heightPC="10" fontSize="20" backgroundColor="-1:-1:-1" foregroundColor="192:192:192">
			<script>
			    print(Category_Title);
			</script>
		</text>';
        } else {
            $rss .= '<backgroundDisplay name="Jukebox">
<image offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="100" useBackgroundSurface="yes" >/usr/local/etc/www/Jukebox/images/poster_background.jpg</image>
  <script>
    Jukebox_itemSize = 0; 
  </script>    
</backgroundDisplay>
<text redraw="yes" align="center" offsetXPC="0" offsetYPC="3" widthPC="100" heightPC="15" foregroundColor="255:255:255" fontSize="30" useBackgroundSurface="yes"><script>getItemInfo(-1, "title");</script></text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="29" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "genre");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="29" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Genre :</text>
<text redraw="yes" lines="1" offsetXPC="62" offsetYPC="22" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="25" useBackgroundSurface="yes"><script>"Runtime: "+getItemInfo(-1, "runtime");</script></text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="42" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "location");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="42" widthPC="19" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Filming Location :</text>
<text redraw="yes" lines="5" offsetXPC="47" offsetYPC="46" widthPC="50" heightPC="17" foregroundColor="255:255:255" fontSize="15" useBackgroundSurface="yes"><script>getItemInfo(-1, "cast");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="46.5" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Cast :</text>
<text redraw="yes" lines="1" offsetXPC="26" offsetYPC="21.5" widthPC="28" heightPC="7" foregroundColor="255:255:255" fontSize="22" useBackgroundSurface="yes"><script>"IMDb rating: "+getItemInfo(-1, "rating")+"/10";</script></text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="33.3" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "director");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="33.3" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Director :</text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="37.5" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "writer");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="37.5" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Writer :</text>
<text redraw="yes" lines="1" offsetXPC="53" offsetYPC="22" widthPC="8" heightPC="5" foregroundColor="255:255:255" fontSize="28" useBackgroundSurface="yes"><script>getItemInfo(-1, "year");</script></text>
<image redraw="yes" offsetXPC="8.3" offsetYPC="17" widthPC="16.5" heightPC="44" ><script>getItemInfo(-1, "path")+"/folder.jpg";</script></image>
<!-- Display watched icon -->
<image type="image/png" redraw="yes" offsetXPC="4" offsetYPC="4" widthPC="10" heightPC="10">
<script>
  MovieID=getItemInfo(-1, "IdMovie");
path2 = getItemInfo(-1, "path");
  check = readStringFromFile(path2 +"/.watched");
  if (check != null) "' . SRJG::JFOLDER . 'images/watched.png";
  /* if (getItemInfo(-1, "Watched") == "1") "' . SRJG::JFOLDER . 'images/watched.png";*/
</script>

</image>
<!-- Display 2cd icon -->
<image type="image/png" redraw="yes" offsetXPC="86" offsetYPC="4" widthPC="10" heightPC="10">
<script>
  MovieTitle=getItemInfo(-1, "file");
  FindCd1=findString(MovieTitle, "cd1");
  if ( FindCd1 == "cd1" ) "' . SRJG::JFOLDER . 'images/2cd.png";
</script>
</image>';
        }
    } else {
        $rss .= '<backgroundDisplay name="Jukebox">
<image offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="100" useBackgroundSurface="yes" >/usr/local/etc/www/Jukebox/images/poster_background.jpg</image>
  <script>
    Jukebox_itemSize = 0; 
  </script>    
</backgroundDisplay>
<text redraw="yes" align="center" offsetXPC="0" offsetYPC="3" widthPC="100" heightPC="15" foregroundColor="255:255:255" fontSize="30" useBackgroundSurface="yes"><script>getItemInfo(-1, "title");</script></text>
<text redraw="yes" lines="4" offsetXPC="6" offsetYPC="70" widthPC="90" heightPC="20" foregroundColor="255:255:255" fontSize="18" useBackgroundSurface="yes"><script>getItemInfo(-1, "plot");</script></text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="29" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "genre");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="29" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Genre :</text>
<text redraw="yes" lines="1" offsetXPC="62" offsetYPC="22" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="25" useBackgroundSurface="yes"><script>"Runtime: "+getItemInfo(-1, "runtime");</script></text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="42" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "location");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="42" widthPC="19" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Filming Location :</text>
<text redraw="yes" lines="5" offsetXPC="47" offsetYPC="46" widthPC="50" heightPC="17" foregroundColor="255:255:255" fontSize="15" useBackgroundSurface="yes"><script>getItemInfo(-1, "cast");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="46.5" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Cast :</text>
<text redraw="yes" lines="1" offsetXPC="26" offsetYPC="21.5" widthPC="28" heightPC="7" foregroundColor="255:255:255" fontSize="22" useBackgroundSurface="yes"><script>"IMDb rating: "+getItemInfo(-1, "rating")+"/10";</script></text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="33.3" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "director");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="33.3" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Director :</text>
<text redraw="yes" lines="1" offsetXPC="46" offsetYPC="37.5" widthPC="90" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes"><script>getItemInfo(-1, "writer");</script></text>
<text redraw="yes" lines="1" offsetXPC="27" offsetYPC="37.5" widthPC="15" heightPC="5" foregroundColor="255:255:255" fontSize="16" useBackgroundSurface="yes">Writer :</text>
<text redraw="yes" lines="1" offsetXPC="53" offsetYPC="22" widthPC="8" heightPC="5" foregroundColor="255:255:255" fontSize="28" useBackgroundSurface="yes"><script>getItemInfo(-1, "year");</script></text>
<!-- Display watched icon -->
<image type="image/png" redraw="yes" offsetXPC="4" offsetYPC="4" widthPC="10" heightPC="10">
<script>
  MovieID=getItemInfo(-1, "IdMovie");
  path2 = getItemInfo(-1, "path");
  check = readStringFromFile(path2 +"/.watched");
  if (check != null) "' . SRJG::JFOLDER . 'images/watched.png";
  /* if (getItemInfo(-1, "Watched") == "1") "' . SRJG::JFOLDER . 'images/watched.png";*/
</script>
</image>

<!-- Display 2cd icon -->
<image type="image/png" redraw="yes" offsetXPC="86" offsetYPC="4" widthPC="10" heightPC="10">
<script>
  MovieTitle=getItemInfo(-1, "file");
  FindCd1=findString(MovieTitle, "cd1");
  if ( FindCd1 == "cd1" ) "' . SRJG::JFOLDER . 'images/2cd.png";
</script>
</image>';
    }
    if (($this->mode == "genreSelection") || ($this->mode == "alphaSelection") || ($this->mode == "yearSelection")) {
        $rss .= '
<image redraw="yes" offsetXPC="80" offsetYPC="5.5" widthPC="8" heightPC="6">
				<script>
					print("' . SRJG::JFOLDER . 'images/"+Jukebox_Size+".jpg");
				</script>
    </image>';
    }
    $rss .= '
<onUserInput>
				handle = "false";
				userInput = currentUserInput();
				Current_Item_index = getFocusItemIndex();
				Max_index = (-1 + Jukebox_itemSize);
				Prev_index = (-1 + Current_Item_index);
				Next_index = (1 + Current_Item_index);
				Prev10_index = (-10 + Current_Item_index);
				Next10_index = (10 + Current_Item_index);
				if ( "pageup" == userInput &amp;&amp; Current_Item_index &gt; 9 ) {
					setFocusItemIndex(Prev10_index); 
					handle = "false";
					redrawDisplay();
				} else if ( "pagedown" == userInput ) {
					idx -= -8;
					if(idx &gt;= itemCount)
					idx = itemCount-1;
					handle = "false";
				} else if ( "9" == userInput || "nine" == userInput) {
					fu_path = getItemInfo(-1, "full_path");
					confirm = doModalRss("'. $this->script_url .'?sub_download,"+fu_path+",en");
					handle = "false";
				} else if ( "enter" == userInput ) {
                                    if ( "' . $this->Jukebox_Size . '" == "sheetmovie" ) {
                                        MTitle=getItemInfo(-1, "file");
                                        MPath=getItemInfo(-1, "path");
                                        M_Ext=getItemInfo(-1, "ext");
                                        imdbid=getItemInfo(-1, "IdMovie");
                                        Full_path=getItemInfo(-1, "full_path");
                                        Current_Movie_File=MPath +"/"+ MTitle +"."+ M_Ext;
                                        if ( playz == "0" ) {
                                            if ( M_Ext == "iso" || M_Ext == "ISO" ) { 
                                                playItemURL(Current_Movie_File, 10);
                                            } 
                                            else {
                                                showIdle();
                                                doModalRss("http://127.0.0.1/Jukebox/srjg.php?videorender,"+ urlEncode(Full_path)+",2");
                                                null;
                                            }
                                        }
                                        else {
                                            Full_path=getItemInfo(-1, "full_path");
                                            getURL("' . $this->script_url . '?WatcheUpDB,"+Full_path);
                                            APName = "GBrowserGridViewAP";
                                            menuCmd(APName, "StartPlayVideoFolder", MPath);
                                        }
                                    } 
                                    else if (nextmode == "moviesheet") {
                                        Item_Pos=getFocusItemIndex();
					Genre_Title=urlEncode("' . $this->category_title . '");
                                        jumpToLink("ViewSheet");
                                    } 
                                    else {
					   Genre_Title=urlEncode(getItemInfo(-1, "title"));
					   jumpToLink("NextView");
                                    }
                                    handle = "false";
				}';
    if (($this->mode == "genreSelection") || ($this->mode == "alphaSelection") || ($this->mode == "yearSelection")) {
        $rss .= '
else if ( "one" == userInput ) {
          Genre_Title=urlEncode(Genre_Title); 
					executeScript("SwitchView");
					handle = "false";
					setRefreshTime(10);
				}';
    } else if (($this->mode == "genre") || ($this->mode == "year") || ($this->mode == "alpha") || ($this->mode == "recent") || ($this->mode == "notwatched")) {
        $rss .= '
else if ( "two" == userInput ) {
                                        MovieID=getItemInfo(-1, "IdMovie");
                                        path2 = getItemInfo(-1, "path");
                                        Full_path = getItemInfo(-1, "full_path");
					getURL("' . $this->script_url . '?WatcheUpDB,"+urlEncode(Full_path)+",1");
                                        redrawDisplay();
					handle = "false";
				}';
    }
    $rss .= '
else if ( "video_play" == userInput ) {
          M_ID=getItemInfo(-1, "IdMovie");
          M_Title=getItemInfo(-1, "file");
          M_Path=getItemInfo(-1, "path");
          M_Ext=getItemInfo(-1, "ext");
          Full_path=getItemInfo(-1, "full_path");
          if ( M_Ext == "" || M_Ext == null || M_ID == null ) {
		        Genre_Title=urlEncode(getItemInfo(-1, "title"));
				jumpToLink("NextView");
		 } else {
         Current_Movie_File=M_Path +"/"+ M_Title +"."+ M_Ext;
          Cd2 = "false";
		  if ( M_Ext == "iso" || M_Ext == "ISO" ) { 
            playItemURL(Current_Movie_File, 10);
		  } else {
				showIdle();
                                doModalRss("http://127.0.0.1/Jukebox/srjg.php?videorender,"+ urlEncode(Full_path)+",2");
                                null;
				}
					handle = "false";
			}
        }
        handle;
		</onUserInput>';
    if (($this->Jukebox_Size == "2x6") || ($this->Jukebox_Size == "3x8")) {
        $rss .= '
<!-- Show Folder Name -->
<text offsetXPC="7" offsetYPC="88.8" widthPC="60" heightPC="5" fontSize="14" useBackgroundSurface="yes" foregroundColor="195:196:195" redraw="yes" lines="1">
 <script>
    displayTitle = getItemInfo(-1, "title"); 
    displayTitle;
 </script>
</text>

<!-- Show Page Info -->
<text offsetXPC="85" offsetYPC="88.8" widthPC="8" heightPC="5" fontSize="14" foregroundColor="195:196:195" useBackgroundSurface="yes" redraw="yes" lines="1">
 <script>
  pageInfo = Add(getFocusItemIndex(),1) + "/" + Jukebox_itemSize;
  pageInfo;
 </script>
</text>
<itemDisplay>';
    } else {
        $rss .= '
<itemDisplay>';
    }
    $rss .= '
<!-- Bottom Layer focus/unfocus -->
<image type="image/jpeg" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="100">
 <script>
  if (getDrawingItemState() == "focus")
  { if (getItemInfo(-1, "Watched") == "1") {
      "' . SRJG::JFOLDER . 'images/focus_watched.jpg";
      }
    else {
      "' . SRJG::JFOLDER . 'images/focus.jpg";
      }
  }
  else
  { if (getItemInfo(-1, "Watched") == "1") {
      "' . SRJG::JFOLDER . 'images/unfocus_watched.jpg";
      }
    else {
      "' . SRJG::JFOLDER . 'images/unfocus.jpg";
      }
  }
 </script>
</image>';
    if ($this->mode == "yearSelection") {
        $rss .= '<!-- Top Layer folder.jpg -->
<image type="image/jpeg" offsetXPC="8.2" offsetYPC="5.5" widthPC="84.25" heightPC="89.25">
 <script>
  thumbnailPath = "' . SRJG::JFOLDER . 'images/yearfolder.jpg";
  thumbnailPath;
 </script>
</image>
<text offsetXPC="9" offsetYPC="31" widthPC="105" heightPC="20" fontSize="7.5" align="center" foregroundColor="0:0:0">
<script>
	year = getItemInfo(-1, "title");
	if ( year == "" || year == null) {
		year = "****"; }
	year;
</script>
</text>';
    } else {
        $rss .= '<!-- Top Layer folder.jpg -->
<image type="image/jpeg" redraw="yes" offsetXPC="8.2" offsetYPC="5.5" widthPC="84.25" heightPC="89.25">
 <script>
  ItemPath  = getItemInfo(-1, "path");
  ItemFile = getItemInfo(-1, "file");
 thumbnailPath = ItemPath +"/"+ ItemFile +".jpg";
 Etat = readStringFromFile(thumbnailPath);
  if (Etat==null){
    thumbnailPath = ItemPath +"/folder.jpg";
    Etat = readStringFromFile(thumbnailPath);
    if (Etat==null){
      thumbnailPath = "' . SRJG::JFOLDER . 'images/nofolder.jpg";
    }
  }
  thumbnailPath;
 </script>
</image>

<!-- Display watched icon -->
<image type="image/png" redraw="yes" offsetXPC="3.2" offsetYPC="3.0" widthPC="20" heightPC="15">
<script>
  MovieID=getItemInfo(-1, "IdMovie");
  path2 = getItemInfo(-1, "path");
  check = readStringFromFile(path2 +"/.watched");
  if (check != null) "' . SRJG::JFOLDER . 'images/watched.png";
  /* if (getItemInfo(-1, "Watched") == "1") "' . SRJG::JFOLDER . 'images/watched.png"; */
</script>
</image>

<!-- Display 2cd icon -->
<image type="image/png" redraw="yes" offsetXPC="75" offsetYPC="4" widthPC="20" heightPC="15">
<script>
  MovieTitle=getItemInfo(-1, "file");
  FindCd1=findString(MovieTitle, "cd1");
  if ( FindCd1 == "cd1" ) "' . SRJG::JFOLDER . 'images/2cd.png";
</script>
</image>';
        if ($this->mode == "genreSelection") {
            $rss .= '
<text offsetXPC="4" offsetYPC="78" widthPC="98" heightPC="13" fontSize="9" align="center" foregroundColor="0:0:0">
<script>
	getItemInfo(-1, "title");
</script>
</text>';
        }
    }
    $rss .= '
</itemDisplay>
</mediaDisplay>

<NextView>
    <link>
       <script>
			print("' . $this->script_url . '?' . $nextmode . ',"+Genre_Title+","+Jukebox_Size);
       </script>
    </link>
</NextView>';
    if (($this->mode == "genre") || ($this->mode == "year") || ($this->mode == "alpha") || ($this->mode == "recent") || ($this->mode == "notwatched") || ($this->mode == "moviesearch")) {
        $rss .= '
<ViewSheet>
    <link>
       <script>
          print("' . $this->script_url . '?"+mode+","+Genre_Title+",sheetmovie,"+Item_Pos);
       </script>
    </link>
</ViewSheet>';
    } else if (($this->mode == "genreSelection") || ($this->mode == "alphaSelection") || ($this->mode == "yearSelection")) {
        $rss .= '
<SwitchView>
  if( Jukebox_Size == "2x6" ) Jukebox_Size="3x8" ;
	else if( Jukebox_Size == "3x8") Jukebox_Size="sheetwall";
	else Jukebox_Size="2x6";
	redrawDisplay();
</SwitchView>';
    }
    $rss .= '
<setwatched>
  /* find if also watched, remove it and do nothing, else add the modified state into array */
  AWatched_found="false";
  i=0;
  TmpTst = "false";
  while(i &lt; AWatched_size ){
    TmpID=getStringArrayAt(AWatched,i);
    TmpW=getStringArrayAt(AWatched,add(i,1));
    if (TmpW == "1" &amp;&amp; EndPlay == "true" ) TmpTst = "true"; else TmpTst = "false";
    if (MovieID == TmpID) {
      if ( TmpTst == "false" ){
        AWatched=deleteStringArrayAt(AWatched, i);
        AWatched=deleteStringArrayAt(AWatched, i);
        AWatched_size -=2;
      }
      AWatched_found="true";
      break;
    }
  	i += 2;
  }
  Watched = 1;
  if ( AWatched_found != "true" ) {
    AWatched=pushBackStringArray(AWatched, MovieID);
    AWatched=pushBackStringArray(AWatched, Watched);
    AWatched_size +=2;
  } else if (Item_Watched == "1") { Watched = 1; } else { Watched = 0; } /* reset toggle watch */
</setwatched>

<channel>
	<title><script>Category_Title;</script></title>';
    $rss .= $this->prepare_items();
    $rss .= '</channel>
</rss>
    ';
    echo $rss;
} else {
    $this->FBrowser();
}
?>
